/*
    pta B1064
*/

#include<bits/stdc++.h>
using namespace std;
map<int,int>mp;
int f(int x)
{
	int sum=0;
	while(x) sum+=x%10,x/=10;
	return sum;
}
int main(void)
{
	int n; cin>>n;
	while(n--)
	{
		int x; cin>>x;
		mp[f(x)]++;
	}
	cout<<mp.size()<<endl;;
	for(auto i=mp.begin();i!=mp.end();i++)
	{
        if(i!=mp.begin()) cout<<" ";
		cout<<i->first<<" -- "<<i->second;
	}
	return 0;
}
